﻿using System.Data.Linq;
using System.Data.Linq.Mapping;


namespace DebIt.Persistence.Model
{
    [Table(Name = "Clients")]
    public class ClientPo
    {

        #region variables

        [Column(IsVersion = true)]
        private Binary _version;
        private readonly EntitySet<ClientLoanStatePo> _clientLoanStates = new EntitySet<ClientLoanStatePo>();

        #endregion
        

        #region properties

        [Column( IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int ClientId { get;  set; }

        [Column(CanBeNull = false)]
        public string LastName { get; set; }

        [Column(CanBeNull = false)]
        public string FirstName { get; set; }

        [Column(CanBeNull = true)]
        public string Phonenumber { get; set; }

        [Column(CanBeNull = true)]
        public string EMailAddress { get; set; }

        [Association(Storage = "_clientLoanStates", OtherKey = "ClientId", DeleteRule = "CASCADE")]
        public EntitySet<ClientLoanStatePo> ClientLoanStates
        {
            get { return _clientLoanStates; }
            set { _clientLoanStates.Assign(value); }
        }

        #endregion

    }
}
